/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.ylystudio.pms.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Kenny Lin
 */
@Entity
@Table(name = "project_problem")
@NamedQueries({
    @NamedQuery(name = "ProjectProblem.findAll", query = "SELECT p FROM ProjectProblem p"),
    @NamedQuery(name = "ProjectProblem.findByPpId", query = "SELECT p FROM ProjectProblem p WHERE p.ppId = :ppId"),
    @NamedQuery(name = "ProjectProblem.findByPpDescrip", query = "SELECT p FROM ProjectProblem p WHERE p.ppDescrip = :ppDescrip"),
    @NamedQuery(name = "ProjectProblem.findByPpDate", query = "SELECT p FROM ProjectProblem p WHERE p.ppDate = :ppDate"),
    @NamedQuery(name = "ProjectProblem.findByPpLevel", query = "SELECT p FROM ProjectProblem p WHERE p.ppLevel = :ppLevel"),
    @NamedQuery(name = "ProjectProblem.findByPpName", query = "SELECT p FROM ProjectProblem p WHERE p.ppName = :ppName"),
    @NamedQuery(name = "ProjectProblem.findByPpSolve", query = "SELECT p FROM ProjectProblem p WHERE p.ppSolve = :ppSolve")})
public class ProjectProblem implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "pp_id")
    private Integer ppId;
    @Column(name = "pp_descrip")
    private String ppDescrip;
    @Basic(optional = false)
    @Column(name = "pp_date")
    @Temporal(TemporalType.DATE)
    private Date ppDate;
    @Basic(optional = false)
    @Column(name = "pp_level")
    private int ppLevel;
    @Basic(optional = false)
    @Column(name = "pp_name")
    private String ppName;
    @Column(name = "pp_solve")
    private String ppSolve;
    @JoinColumn(name = "project_id", referencedColumnName = "p_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Project project;
    @JoinColumn(name = "ppc_id", referencedColumnName = "ppc_id")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private ProjectProblemCategory projectProblemCategory;

    public ProjectProblem() {
    }

    public ProjectProblem(Integer ppId) {
        this.ppId = ppId;
    }

    public ProjectProblem(Integer ppId, Date ppDate, int ppLevel, String ppName) {
        this.ppId = ppId;
        this.ppDate = ppDate;
        this.ppLevel = ppLevel;
        this.ppName = ppName;
    }

    public Integer getPpId() {
        return ppId;
    }

    public void setPpId(Integer ppId) {
        this.ppId = ppId;
    }

    public String getPpDescrip() {
        return ppDescrip;
    }

    public void setPpDescrip(String ppDescrip) {
        this.ppDescrip = ppDescrip;
    }

    public Date getPpDate() {
        return ppDate;
    }

    public void setPpDate(Date ppDate) {
        this.ppDate = ppDate;
    }

    public int getPpLevel() {
        return ppLevel;
    }

    public void setPpLevel(int ppLevel) {
        this.ppLevel = ppLevel;
    }

    public String getPpName() {
        return ppName;
    }

    public void setPpName(String ppName) {
        this.ppName = ppName;
    }

    public String getPpSolve() {
        return ppSolve;
    }

    public void setPpSolve(String ppSolve) {
        this.ppSolve = ppSolve;
    }

    public Project getProject() {
        return project;
    }

    public void setProject(Project project) {
        this.project = project;
    }

    public ProjectProblemCategory getProjectProblemCategory() {
        return projectProblemCategory;
    }

    public void setProjectProblemCategory(ProjectProblemCategory projectProblemCategory) {
        this.projectProblemCategory = projectProblemCategory;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ppId != null ? ppId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProjectProblem)) {
            return false;
        }
        ProjectProblem other = (ProjectProblem) object;
        if ((this.ppId == null && other.ppId != null) || (this.ppId != null && !this.ppId.equals(other.ppId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ylystudio.pms.ejb.entity.ProjectProblem[ppId=" + ppId + "]";
    }

}
